<template>
	<view class="mine">
		<view class="user" @click="toProfileInfo">
			<view>
				<view class="top">
					<view class="avatar">
						<image src="https://www.auok.ltd/background.jpg" mode="aspectFill"></image>
					</view>
					<view>
						<view class="nickname">点击登录</view>
						<view class="sign">登录后查看更多</view>
					</view>
				</view>
				<view class="bottom"></view>
			</view>
			<view>
				<u-icon name="arrow-right"></u-icon>
			</view>
		</view>
		<view class="menu-item" v-for="(item,index) in itemList" @click="clickTo(item)">
			<view>
				<u-icon :name="item.icon" size="40"></u-icon> {{item.text}}
			</view>
			<view>
				<u-icon name="arrow-right"></u-icon>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				itemList: [{
					text: '我的主页',
					icon: 'account',
					needlogin:1,
					url: '/pages/profileHome/profileHome?flag=self'
				}, {
					text: '我的关注',
					icon: 'heart',
					needlogin:1,
					url: '/pages/mine/follwAndFans/follwAndFans?flag=1'
				}, {
					text: '我的粉丝',
					icon: 'man-add',
					needlogin:1,
					url: '/pages/mine/follwAndFans/follwAndFans?flag=2'
				}, {
					text: '收藏',
					icon: 'integral',
					needlogin:1,
					url: '/pages/custom/custom?flag=收藏'
				}, {
					text: '实名认证',
					icon: 'eye',
					needlogin:0,
					url: '/pages/custom/custom?flag=实名认证&target=mayizt.com/a/null.php?f=sm'
				}, {
					text: '用户协议',
					icon: 'file-text',
					needlogin:0,
					url: '/pages/custom/custom?flag=用户协议&target=mayizt.com/a/null.php?f=xy'
				}, {
					text: '退出登录',
					icon: 'close-circle',
					needlogin:0,
					url: '/pages/login/login'
				}]
			};
		},
		methods: {

		    toProfileInfo(){
				if(!uni.getStorageSync("token")){
					uni.navigateTo({
						url: '/pages/login/login'
					})
				}else{
					uni.navigateTo({
						url: '/pages/mine/profileInfo/profileInfo'
					})
				}
			}
			,
			clickTo(item) {
				
				
				if(uni.getStorageSync("token")=="" && item.needlogin==1){
					uni.navigateTo({
						url: '/pages/login/login'
					})
				}
				
				if(item.text=="实名认证"){
					window.location.href = 'https://mayizt.com/a/null.php?f=sm'
					return;
				}
			
				if (item.text!="退出登录") {
					uni.navigateTo({
						url: item.url
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '确认退出登录吗',
						success: (res) => {
							if (res.confirm) {
								uni.reLaunch({
									url: '/pages/login/login'
								})
							}
						}
					})
				}

			}
		}
	}
</script>

<style lang="scss" scoped>
	.menu-item {
		display: flex;
		padding: 30rpx;
		justify-content: space-between;
		align-items: center;
		background-color: #FFFFFF;
		margin-bottom: 2rpx;

		.u-icon {
			margin-right: 20rpx;
		}
	}

	.u-icon {
		color: rgba($color: gray, $alpha: .5);
	}

	.user {
		padding: 30rpx;
		background-color: #FFFFFF;
		margin-bottom: 20rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.top {
			display: flex;
			align-items: center;

			.avatar {
				margin-right: 15rpx;

				image {
					height: 100rpx;
					width: 100rpx;
					border-radius: 50%;
				}
			}

			.nickname {
				font-weight: 700;
			}

			.sign {
				font-size: 26rpx;
				padding: 10rpx 0;
				color: rgba($color: gray, $alpha: .5);
			}
		}
	}

	.mine {
		height: 100vh;
		background-color: rgba(127, 127, 127, .1);
		overflow: hidden;
	}
</style>
